Skip to content

Add runtime docstrings to stubs in release wheels - #1274

Merged
Joao-Dionisio merged 5 commits into
scipopt:masterfrom
jonathanberthias:typing/wheel-docstrings
Oct 25, 2026
Merged

Joao-Dionisio merged 5 commits into
scipopt:masterfrom
jonathanberthias:typing/wheel-docstrings

Conversation

@jonathanberthias

@jonathanberthias jonathanberthias commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

The bundled type stubs contain no docstrings, so editors using them can miss the documentation available on the compiled extension.

This PR copies existing runtime docstrings into the stubs during release wheel builds using docstring-adder. It runs after native libraries are bundled and repacks the wheel with updated file hashes. This applies to Python 3.10 and later, as required by docstring-adder.

The implementation was generated with AI assistance.

Part of #1072

@Joao-Dionisio

Copy link
Copy Markdown
Member

The implementation was generated with AI assistance.

Thank you so much for the disclosure, @jonathanberthias ! I'm assuming you reviewed the changes already, correct?

@jonathanberthias

Copy link
Copy Markdown
Contributor Author

Thank you so much for the disclosure, @jonathanberthias ! I'm assuming you reviewed the changes already, correct?

I ran the build workflow on my fork and it seems to work, but I know very little about cibuildwheel so perhaps there's a better way. This was done by Sol 6.1, maybe if you have access to other models they can come up with different ideas 🤷

@Joao-Dionisio

Copy link
Copy Markdown
Member

Hey @jonathanberthias , simplified the code a bit. I'm now running the wheels and will merge if they pass. Locally, it's working on my Mac, it's very useful!

@Joao-Dionisio

Joao-Dionisio commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Everything is passing, can you check on your machine if it's working as well, please? @jonathanberthias

https://github.com/scipopt/PySCIPOpt/actions/runs/40122535454

@Joao-Dionisio
Joao-Dionisio self-requested a review October 24, 2026 19:41
@Joao-Dionisio
Joao-Dionisio added this pull request to the merge queue Oct 25, 2026
Merged via the queue into scipopt:master with commit a7fd71e Oct 25, 2026
7 checks passed
@mkoeppe

mkoeppe commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Why is this done in the repair-wheel phase? Shouldn't this be done in the normal wheel building phase?

@jonathanberthias

Copy link
Copy Markdown
Contributor Author

Why is this done in the repair-wheel phase? Shouldn't this be done in the normal wheel building phase?

It could also run during the normal build, though that would require some customization of the setuptools build phase. The cibuildwheel hook seemed simpler since this is only needed for release wheels. Maybe there is a better way 🤷

@mkoeppe

mkoeppe commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Why would it only be needed for the PyPI wheels? With the current solution, won't the stubs be missing docstrings in the conda-forge packaging of PySCIPopt, for example?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants